<?php  if (!defined("IS_INITPHP")) exit("Access Denied!");  /* INITPHP Version 1.0 ,Create on 2016-07-25 06:31:03, compiled from ../app/web/template/admin/example_list.html */ ?>
<script type="text/javascript">
	function adds(){
		var newname=$("[name=credit]").val();
		//var level='<?php echo $level;?>';
		
		// 限制一级分类个数 on 1-7 by wxy
		var upid='<?php echo $upid;?>';
		var show=0;
		if(upid=='0'||upid==''){
			var numc = $(".numc");
			if(numc.length>5){
				show=1;
			}
		}
		if(newname!=''){
			$.post(
				'cate_list.php?action=add&upid=<?php echo $upid;?>',
				{newname:newname},
				function(data){
					if(data.error=='1'){
						$("#addmore").before(data.html);
						initUI("#cate"+data.id);
						$("[name=credit]").val("");				//置空
						// 移除添加 on 1-7
						if(show==1){
							$("#addmore").remove();
						}
					}else{
						//alert(data.msg);
						alertMsg.error(data.msg);
						return false;
					}
				},'json')
		}else{
			//alert("请填写类目名称！");
			alertMsg.error("请填写类目名称！");
			return false;
		}
	}
function edit (obj,url,id) {
	var edits=obj.parent().parent().parent().find(".edits");
	var vals=edits.find("div").text();
	var htmls='<input name="save" value="'+vals+'">';
	edits.html(htmls);
	obj.attr("onclick",'save($(this),"'+url+'",'+id+')');
	obj.text('保存');
}

function save(obj,url,id){
	var aim=obj.parent().parent().parent().find(".edits");
	vals=aim.find("[name=save]").val();
	// 判空   on 2016-1-14
	if(vals == ''){
		alertMsg.error("信息不可为空");
		return false;
	}
	$.post(
		url,
		{vals:vals,id:id},
		function(data){
			if(data=='1'){
				aim.html('<div>'+vals+'</div>');
				obj.attr("onclick",'edit($(this),"'+url+'",'+id+')');
				obj.text('修改');
			}else if(data=='er'){
				alertMsg.error('此信息已存在');
				return false;
			}else{
				alertMsg.error('保存错误！');
				return false;
			}
		}
		)
}

</script>
<form id="pagerForm" action="<?php echo $page_basename;?>" method="post" action="#rel#">
	<input type="hidden" name="pageNum" value="<?php $page.nowPage ?>" />
	<input type="hidden" name="numPerPage" value="<?php $page.num ?>" />
	<input type="hidden" name="orderField" value="${param.orderField}" /><!--查询排序字段名-->
	<input type="hidden" name="orderDirection" value="${param.orderDirection}" /><!--排序方式-->
</form>

<div class="pageHeader" style="display: ;">
	<form  onsubmit="return navTabSearch(this);" action="" method="post">
		  
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>
						<label>用户名：</label>
						<input type="text" name="title" value="<?php echo $search['title'];?>"/>
					</td>
					<td>
						<label>审核：</label>
						<select class="combox" name="state">
						<option  value="">选择</option>
						<option <?php if($search['state'] == 'yes'){ ?>selected="selected"<?php } ?> value="yes">通过</option>
						<option <?php if($search['state'] == 'no'){ ?>selected="selected"<?php } ?> value="no">未通过</option>
						</select>
					</td>
					
					<td>
						<div class="subBar">
							<ul>
								<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
							</ul>
			            </div>
					</td>
				</tr>
			</table>	
		</div>

	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="admin.php?c=example&a=example_add" target="navTab" width="577" height="300" rel="addvisit"><span>添加</span></a></li>
			<li><a class="delete page_node" _node="del" target="selectedTodo" rel="id"  warn="请先选择" postType="string"  href="admin.php?c=example&a=example_list&action=del" title="请谨慎操作！！确定删除？" ><span>批量删除</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="115">
		<thead>
			<tr>		
				<th align="center" style="width:5%;" ><input type="checkbox" group="id" class="checkboxCtrl"></th>	
				<!-- <th align="center" style="width:5%;" >序号</th> -->
				<th align="center"  >ID</th>
				<th align="center"  >管理员账号</th>
				<th align="center"  >时间</th>
				<th align="center"  >真实姓名</th>
				<th align="center"  >创建时间</th>
				<th align="center"  >审核</th>
				<th align="center"  >编辑</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($list as $k => $v){  ?>
				<tr target="id" rel="<?php echo $v['id'];?>">
					<td><input name="id" value="<?php echo $v['id'];?>" type="checkbox"></td>
					<!-- <td><?php $res.partner_id ?></td> -->
					<td><?php echo $v['id'];?></td>
					<td class="edits"><?php echo $v['title'];?></td>
					<td><?php echo date("Y-m-d",$v['date']) ?></td>
					<td><?php echo $v['realname'];?></td>
					<td><?php echo date("Y-m-d",$v['date']) ?></td>
					<td><?php if($v['state'] == 'no'){ ?>未通过<?php }else{ ?>通过<?php } ?></td>
					<td>
						<a target="navTab" href="partner_veiw.php?id=<?php echo $v['title'];?>"  rel="look" mask="true"><span>查看</span></a>
						|
						<a target="navTab" href="admin.php?c=example&a=example_edit&id=<?php echo $v['id'];?>" width="577" height="300" rel="updatevisit"><span>修改</span></a>
						|
						<a target="dialog" href="admin.php?c=example&a=example_edit&id=<?php echo $v['id'];?>&type=dialog" width="800" height="400" mask="true" rel="stop">弹窗修改</a>
						|
						<a target="" href="javascript:;" class="page_node" _node="edit" onclick="edit($(this),'admin.php?c=example&a=example_list&action=edit',<?php echo $v['id'];?>);" rel="updatevisit"><span>动态修改</span></a>
						|
						<a target="ajaxTodo" class="page_node" _node="del" href="admin.php?c=example&a=example_list&action=del&id=<?php echo $v['id'];?>" title="请谨慎操作！！确定删除？" ><span>删除</span></a>
						
					</td>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="20" <?php if ($page['num']=='20'){ ?>selected="selected"<?php } ?>>20</option>
				<option value="50" <?php if ($page['num']=='50'){ ?>selected="selected"<?php } ?>>50</option>
				<option value="100" <?php if ($page['num']=='100'){ ?>selected="selected"<?php } ?>>100</option>
				<option value="200" <?php if ($page['num']=='200'){ ?>selected="selected"<?php } ?>>200</option>
			</select>
			<span>条，共<?php echo $page['total'];?>条</span>	
			
		</div>
		<div class="pagination" targetType="navTab" totalCount="<?php echo $page['total'];?>" numPerPage="<?php echo $page['num'];?>" pageNumShown="10" currentPage="<?php echo $page['nowPage'];?>"></div>
	</div>
</div>
